package interview_questions;

import java.util.Scanner;

public class Main1_8 {
	public static boolean isSubstring(String s1, String s2) {
		if (s1.indexOf(s2) != -1)
			return true;
		else
			return false;
	}
	
	public static boolean isRotation(String s1, String s2) {
		int len = s1.length();
		if (len == s2.length() && len > 0) {
			String s1s1 = s1 + s1;
			if (isSubstring(s1s1, s2))
				return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s1 = in.next();
		String s2 = in.next();
		if (isRotation(s1, s2))
			System.out.println("Yes!");
		else
			System.out.println("No!");
		in.close();
	}

}